﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using System.Data.Linq.Mapping;

namespace Runda.CMS.Order.Entity
{
    [Table(Name = "Account")]
    public class Account
    {
        [Column(Name = "AccountID",DbType = "uniqueidentifier NOT NULL", IsPrimaryKey = true, CanBeNull = false, IsDbGenerated = true)]
        public Guid AccountID
        {
            get;
            set;
        }

        [Column(Name = "AccountName", DbType = "VarChar(60) NOT NULL", CanBeNull = false, UpdateCheck = UpdateCheck.Never)]
        public String accountName
        {
            get;
            set;
        }
        [Column(Name = "Password", DbType = "VarChar(60) NOT NULL", CanBeNull = false, UpdateCheck = UpdateCheck.Never)]
        public String password
        {
            get;
            set;
        }

        [Column(Name = "CustomerID", DbType = "VarChar(20) NOT NULL", CanBeNull = false, UpdateCheck = UpdateCheck.Never)]
        public String customerID
        {
            get;
            set;
        }
        public Account() { 
        
        }
        public Account(String password, String customerID,String accountName) {
            String encordPassword = password;//System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
            this.customerID = customerID;
            this.password = encordPassword;
            this.accountName = accountName;    
            this.AccountID = Guid.NewGuid();
        }

        public void resetPassword(String password) {
            String encordPassword = password;// System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
            this.password = encordPassword;
        }                 
    }
}
